package ishitong.vehicleManagement.dao;

import ishitong.vehicleManagement.model.StealRobVehicle;
import com.ishitong.platform.common.dao.GenericDao;
import com.ishitong.platform.common.page.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import ishitong.vehicleManagement.model.StealRobVehicleQuery;
import java.util.List;
import java.util.ArrayList;

/** @pdOid ff6ee28a-2052-4cfc-a568-9cb8081755d9
 * @创建日期:2013-09-27 12:15:24
 * 
 * @功能描述:RVIMS_StealRobVehicle
 * @开发人员:福建视通 */
@Repository(value="stealRobVehicleDao")
public class StealRobVehicleDao extends GenericDao<StealRobVehicle> {
   /** @param query 
    * @param pageSize 
    * @param pageNum
    * @pdOid 82d40950-c3f7-43b5-82f5-8d4677616f23
    * @功能描述: 通过StealRobVehicleQuery对象，查询RVIMS_StealRobVehicle
    * @异常类型: */
   public Page findPage(StealRobVehicleQuery query, int pageSize, int pageNum) {
   	StringBuilder hql=new StringBuilder();
   	hql.append(" from StealRobVehicle ett where 1=1");
   	List param=new ArrayList();
   	if(query!=null){
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getId()))){
   			hql.append(" and ett.id=?");
   			param.add(query.getId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getPlateNum()))){
   			hql.append(" and ett.plateNum=?");
   			param.add(query.getPlateNum().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getPlateTypeId()))){
   			hql.append(" and ett.plateTypeId=?");
   			param.add(query.getPlateTypeId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleBrand()))){
   			hql.append(" and ett.vehicleBrand=?");
   			param.add(query.getVehicleBrand().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getImageURL()))){
   			hql.append(" and ett.imageURL=?");
   			param.add(query.getImageURL().trim());
   		}
   		if(query.getCertificationDate()!=null){
   			hql.append(" and ett.certificationDate=?");
   			param.add(query.getCertificationDate());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getPlateColorId()))){
   			hql.append(" and ett.plateColorId=?");
   			param.add(query.getPlateColorId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getUsingCharacterId()))){
   			hql.append(" and ett.usingCharacterId=?");
   			param.add(query.getUsingCharacterId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleId()))){
   			hql.append(" and ett.vehicleId=?");
   			param.add(query.getVehicleId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleClassificationId()))){
   			hql.append(" and ett.vehicleClassificationId=?");
   			param.add(query.getVehicleClassificationId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleColorId()))){
   			hql.append(" and ett.vehicleColorId=?");
   			param.add(query.getVehicleColorId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleTypeId()))){
   			hql.append(" and ett.vehicleTypeId=?");
   			param.add(query.getVehicleTypeId().trim());
   		}
   		if(query.getPlateColor()!=null){
   			hql.append(" and ett.plateColor=?");
   			param.add(query.getPlateColor());
   		}
   		if(query.getUsingCharacter()!=null){
   			hql.append(" and ett.usingCharacter=?");
   			param.add(query.getUsingCharacter());
   		}
   		if(query.getVehicle()!=null){
   			hql.append(" and ett.vehicle=?");
   			param.add(query.getVehicle());
   		}
   		if(query.getVehicleClassification()!=null){
   			hql.append(" and ett.vehicleClassification=?");
   			param.add(query.getVehicleClassification());
   		}
   		if(query.getVehicleColor()!=null){
   			hql.append(" and ett.vehicleColor=?");
   			param.add(query.getVehicleColor());
   		}
   		if(query.getVehicleType()!=null){
   			hql.append(" and ett.vehicleType=?");
   			param.add(query.getVehicleType());
   		}
   	}
   	return this.findByHql(hql.toString(), pageSize, pageNum, param.toArray());
   }
   
   /** @param query
    * @pdOid 031f73e5-cfc0-47e0-a565-63b2af26e4da
    * @功能描述: 通过StealRobVehicleQuery对象，查询RVIMS_StealRobVehicle
    * @异常类型: */
   public List<StealRobVehicle> findList(StealRobVehicleQuery query) {
   	StringBuilder hql=new StringBuilder();
   	hql.append(" from StealRobVehicle ett where 1=1");
   	List param=new ArrayList();
   	if(query!=null){
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getId()))){
   			hql.append(" and ett.id=?");
   			param.add(query.getId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleBrand()))){
   			hql.append(" and ett.vehicleBrand=?");
   			param.add(query.getVehicleBrand().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getImageURL()))){
   			hql.append(" and ett.imageURL=?");
   			param.add(query.getImageURL().trim());
   		}
   		if(query.getCertificationDate()!=null){
   			hql.append(" and ett.certificationDate=?");
   			param.add(query.getCertificationDate());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getPlateColorId()))){
   			hql.append(" and ett.plateColorId=?");
   			param.add(query.getPlateColorId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getUsingCharacterId()))){
   			hql.append(" and ett.usingCharacterId=?");
   			param.add(query.getUsingCharacterId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleId()))){
   			hql.append(" and ett.vehicleId=?");
   			param.add(query.getVehicleId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleClassificationId()))){
   			hql.append(" and ett.vehicleClassificationId=?");
   			param.add(query.getVehicleClassificationId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleColorId()))){
   			hql.append(" and ett.vehicleColorId=?");
   			param.add(query.getVehicleColorId().trim());
   		}
   		if(!StringUtils.isEmpty(StringUtils.trimToEmpty(query.getVehicleTypeId()))){
   			hql.append(" and ett.vehicleTypeId=?");
   			param.add(query.getVehicleTypeId().trim());
   		}
   		if(query.getPlateColor()!=null){
   			hql.append(" and ett.plateColor=?");
   			param.add(query.getPlateColor());
   		}
   		if(query.getUsingCharacter()!=null){
   			hql.append(" and ett.usingCharacter=?");
   			param.add(query.getUsingCharacter());
   		}
   		if(query.getVehicle()!=null){
   			hql.append(" and ett.vehicle=?");
   			param.add(query.getVehicle());
   		}
   		if(query.getVehicleClassification()!=null){
   			hql.append(" and ett.vehicleClassification=?");
   			param.add(query.getVehicleClassification());
   		}
   		if(query.getVehicleColor()!=null){
   			hql.append(" and ett.vehicleColor=?");
   			param.add(query.getVehicleColor());
   		}
   		if(query.getVehicleType()!=null){
   			hql.append(" and ett.vehicleType=?");
   			param.add(query.getVehicleType());
   		}
   	}
   	return this.findFastByHql(hql.toString(), param.toArray());
   }

}